<template>
  <page-list :x-uri="uri" :custom-components="custom" :search-options="searchOptions" :checkbox-item="false">
    <!-- 自定义tab -->
    <template v-slot:page-tabs>
      <tabs />
    </template>
  </page-list>
</template>
<script>
import PageList from '@public/template/page_list.vue';
import User from './components/user';
import Tabs from '../tabs';
export default {
  components: {
    PageList,
    Tabs
  },
  data() {
    return {
      uri: '/admin/system/log/list',
      custom: {
        user_name: User
      },
      searchOptions: {
        date: {
          shortcuts: [
            {
              text: '今天',
              onClick(picker) {
                const current = new Date();
                const time = (current.getHours() * 60 * 60 + current.getMinutes() * 60 + current.getSeconds()) * 1000;
                const start = new Date(current.getTime() - time);
                const end = new Date();
                picker.$emit('pick', [start, end]);
              }
            },
            {
              text: '最近一周',
              onClick(picker) {
                const end = new Date();
                const start = new Date();
                start.setTime(start.getTime() - 8.64e7 * 7);
                picker.$emit('pick', [start, end]);
              }
            },
            {
              text: '最近一个月',
              onClick(picker) {
                const end = new Date();
                const start = new Date();
                start.setTime(start.getTime() - 8.64e7 * 30);
                picker.$emit('pick', [start, end]);
              }
            },
            {
              text: '最近三个月',
              onClick(picker) {
                const end = new Date();
                const start = new Date();
                start.setTime(start.getTime() - 8.64e7 * 90);
                picker.$emit('pick', [start, end]);
              }
            }
          ]
        }
      }
    };
  }
};
</script>
